package com.cbank.utils;

import java.util.HashMap;
import java.util.Map;

public enum NumConvertEnEnum {

    JANUARY(1,"Jan."),  
    FEBRUARY(2,"Feb."),    
    MARCH(3,"Mar."),  
    APRIL(4,"Apr."),
    MAY(5,"May."),
    JUNE(6,"Jun."),
    JULY(7,"Jul."),  
    AUGUST(8,"Aug."),
    SEPTEMBER(9,"Sept."),
    OCTOBER(10,"Oct."),
    NOVEMBER(11,"Nov."),           
    DECEMBER(12,"Dec.");

    private Integer value;
    private String display;

    NumConvertEnEnum(Integer value, String display) {
        this.value = value;
        this.display = display;
    }

    private static Map<Integer, NumConvertEnEnum> valueMap = new HashMap<>();

    static {
        for (NumConvertEnEnum e : NumConvertEnEnum.values()) {
            valueMap.put(e.value, e);
        }
    }

    public Integer getValue() {
        return value;
    }

    public String getDisplay() {
        return display;
    }

    public static NumConvertEnEnum getByValue(Integer value) {
        NumConvertEnEnum result = valueMap.get(value);
        if (result == null) {
            throw new IllegalArgumentException("No element matches " + value);
        }
        return result;
    }
}
